<?php
/**
 * User: MT
 * Date: 2018/5/23 0023
 */
namespace core\lib\drive\log;
use core\lib\config;

class file{
    public $path;
    function __construct()
    {
        $this->path = config::get('path','log');
    }
    public function log($message,$file){
        //没有文件则创建
        $path_dir = $this->path.date('Ymd');
        if(!is_dir($path_dir)){
            mkdir($path_dir,0777,true);
        }
        $file = $path_dir.'/'.$file.'.php';
        file_put_contents($file,date('Y-m-d H:i:s').json_encode($message).PHP_EOL,FILE_APPEND);
    }
}